package String;

import java.util.Scanner;

public class 遍历字符串 {
    public static void main(String[] args) {
        Scanner sc =new Scanner(System.in);
        System.out.println("请输入一个字符串");
        String line = sc.nextLine();
        //遍历字符串
     /*   System.out.println(line.charAt(0));
        System.out.println(line.charAt(1));
        System.out.println(line.charAt(2));*/
        //字符串的长度   对象名.length()!!!
        for (int i=0;i<line.length();i++){
            System.out.println(line.charAt(i));
        }

    }
}
